package com.sysd.mail.smtp.command;

import com.sysd.mail.smtp.SmtpSession;

import java.io.IOException;

/**
 * project: mail
 *
 * @author bsh
 * @description DataCommand
 * @dataTime 2023/3/28 15:12
 * @company 丽水信阳软件科技有限公司
 */
public class DataCommand extends BaseSmtpCommand {
    public DataCommand( ) {
        super("DATA");
    }

    /**
     * 执行命令
     *
     * @param command     命令名称
     * @param smtpSession smtp session
     * @return smtp session
     * @throws IOException io exception
     */
    @Override
    public SmtpSession execute(String command, SmtpSession smtpSession) throws IOException {
        smtpSession.write("354 End data with <CR><LF>.<CR><LF>\r\n");
        smtpSession.setDataProcess(true);
        smtpSession.setBuf(new StringBuilder());
        return smtpSession;
    }
}
